package com.iw.adoms.dao;

import java.util.List;

import com.iw.adoms.entity.Goods;
import com.iw.adoms.entity.neum.Status;
import com.iw.core.orm.Filtration;
import com.iw.core.orm.Filtration.MatchType;
import com.iw.core.orm.hibernate.BaseDao;
import org.springframework.stereotype.Repository;

@Repository
public class GoodsDao extends BaseDao<Goods> {

	public List<Goods> getStockListByMidAndDid(Integer mid, Integer did) {
		Filtration mfilter = new Filtration(MatchType.EQ, mid, "marchandise.id");
		Filtration dfilter = new Filtration(MatchType.EQ, did, "department.id");
		Filtration sfilter = new Filtration(MatchType.EQ, Status.WILL_SALE.getValue(), "state");
		List<Goods> list = this.findList(mfilter, dfilter, sfilter);
		return list;
	}

	public List<Goods> getStockListByMid(Integer mid) {
		Filtration mfilter = new Filtration(MatchType.EQ, mid, "marchandise.id");
		Filtration sfilter = new Filtration(MatchType.EQ, Status.WILL_SALE.getValue(), "state");
		List<Goods> list = this.findList(mfilter, sfilter);
		return list;
	}
	
}
